package com.monitor.tasks;

import com.monitor.commons.YXDate;
import com.monitor.pubInter.exception.SkException;
import com.monitor.service.ICallRecordsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;

/**
 * 通话记录
 */
@Configuration
@EnableScheduling
@Slf4j
public class CallRecordsTask {

    @Autowired
    private ICallRecordsService callRecordsService;
    @Scheduled(cron = "${task.callRecordsStaticCron}")
    public void callRecordsSyncWork() throws SkException {
        Date staticDay = YXDate.addDay(new Date(), -1);
        callRecordsService.syncCallRecordData(staticDay);
    }
}
